﻿#include "tcpsocket.h"
#include <QDebug>

tcpsocket::tcpsocket(QObject *parent) : QTcpSocket(parent)
{
    //客户端发过来的数据触发readyRead信号
    connect(this, &tcpsocket::readyRead, this, &tcpsocket::recvdata);
}

//接收数据
void tcpsocket::recvdata()
{
    int length = 10;
    QByteArray array = readAll();
    QString msg = array;
    emit updateserver(msg, length);
}
